<template>
  <div class="itemMusicTop">
  <img :src="playlist.coverImgUrl" class="bgimg">
  <div class="itemLeft">
    <svg class="icon" aria-hidden="true" @click="this.$router.go(-1)">
          <use xlink:href="#icon-zuojiantou"></use>
    </svg>
    <span>歌单</span>
  </div>
  <div class="itemRight">
    <svg class="icon" aria-hidden="true">
        <use xlink:href="#icon-sousuo"></use>
    </svg>
    <svg class="icon" aria-hidden="true">
        <use xlink:href="#icon-liebiao"></use>
    </svg>
  </div>
  </div>
  <div class="itemContent">
  <div class="contentLeft">
    <img :src="playlist.coverImgUrl">
          <span class="playCount"> 
               <svg class="icon" aria-hidden="true">
                   <use xlink:href="#icon-play"></use>
               </svg>
               {{ changeCount(playlist.playCount) }}
          </span>
  </div>
  <div class="contentRight">
  <div class="rightOne"> 
     <span>{{ playlist.name }}</span>
  </div>
  <div class="rightTwo">
    <img :src="playlist.creator.backgroundUrl">
     <span>{{ playlist.creator.nickname }}</span>
      <svg class="icon" aria-hidden="true">
         <use xlink:href="#icon-youjiantou"></use>
      </svg>  
  </div>
  <p class="rightThree">{{ playlist.description }}</p>
  </div>
  </div>
  <div class="foot">
  <div class="footItem"> 
       <svg class="icon"  aria-hidden="true">
         <use xlink:href="#icon-xiaoxi"></use>
      </svg> 
      <span>{{ playlist.commentCount }}</span>
  </div>
  <div class="footItem"> 
       <svg class="icon" aria-hidden="true">
         <use xlink:href="#icon-fenxiang"></use>
      </svg> 
      <span>{{playlist.shareCount}}</span>
  </div>
  <div class="footItem"> 
       <svg class="icon" aria-hidden="true">
         <use xlink:href="#icon-xiazai1"></use>
      </svg> 
      <span>下载</span>
  </div>
  <div class="footItem"> 
       <svg class="icon" aria-hidden="true">
         <use xlink:href="#icon-xuanze-duoxuan-tianchong"></use>
      </svg> 
      <span>多选</span>
  </div>
  </div>
</template>

<script>
    export default {
      setup(props){
      if(props.playlist.creator='') {
        props.playlist.creator = JSON.parse(sessionStorage.getItem('playlist')).playlist.creator
      }
      function changeCount(count){
      if(count>10000){
        return (count/10000).toFixed(1)+'w'
      }
    }
    return {changeCount}
      },
      props:['playlist']
    }
</script>

<style lang="scss" scoped>
  .itemMusicTop{
    position: relative;
    width: 100%;
    height: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .bgimg{
      position: absolute;
      width: 100%;
      height: 9rem;
      z-index: -1;
      filter: blur(30px);
    }
    .itemLeft,.itemRight{
      margin: 0 .2rem;
      width: 25%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .icon{
        fill: #fff;
      }
      span{
          font-size: .36rem;
          color: #fff;
      }
    }
  }
  .itemContent{
    width: 100%;
    height: 2.6rem;
    padding: .2rem;
    display: flex;
    justify-content: center;
    .contentLeft{
      width: 2.4rem;
      height: 2.4rem;
      position: relative;
     img{
      width: 100%;
      height: 100%;
      border-radius: 15px;
     }
     .playCount{
        display: flex;
        align-items: center;
        position: absolute;
        top: 0;
        right: .2rem;
        font-size: .16rem;
        color: aliceblue;
        line-height:.58rem ;
        // z-index: 999;
        .icon{
          width: .2rem;
          color: #000;
        }
      }
    }
    .contentRight{
      width: 64% ;
      padding-left:.3rem ;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content:space-between;
       
      .rightOne{
        color: #fff;
        font-size: .28rem;
        font-weight: 800;   
      }
      .rightTwo{
        width: 100%;
        height: .6rem;  
        span{
          margin-left: .2rem;
          color: #a8a6a6;
          font-size: .28rem;  
        }
        img{
          width: .6rem;
          height: .6rem;
          border-radius: 100%;
          vertical-align:middle
        }
        .icon{
          width: .28rem;
          fill:#a8a6a6;
          vertical-align:middle
        }
      }
      .rightThree{
        width: 100%;
        height: .5rem; 
        color: #ccc;
        font-size: .24rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }
  .foot {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    .footItem{
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .icon{
        fill: #fff;
        width: .5rem;
        height: .5rem;
      }
      span{
        color: #fff;
        margin-top: .2rem ;
      }
    }
  }
</style>